#include <stdio.h>
#include <iostream>


#include "Set.h"

/* References
*  Wikipedia
*		- http://en.wikipedia.org/wiki/Disjoint-set_data_structure
* The Design and Analyis of Algorithms - Section 9.2
*/
Set *makeSet(Set *s)
{
	s->parent = s;
	return s;
}

Set* findSet(Set *set)
{

	if (set->parent == set)
		return set;
	else
		return findSet(set->parent);
	
}

void unionSet(Set *s1, Set *s2)
{
	Set *s1Root = findSet(s1);
	Set *s2Root = findSet(s2);
	s1Root->parent = s2Root;
}


